Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remembering scrolling position #238

Closed
wants to merge 1 commit into from

Conversation

SpringerJack
Copy link

Relates to #232

Since 0058352 the tabs albums and artists do not remember the user's position anymore. The culprit seems to be a call not happening early on in onCreateView() but rather with initialization in onViewCreated().

Reverting this does not seem like an ideal solution. Suggestions are welcome in case anybody knows how to handle this properly.

@gnome17
Copy link
Member

gnome17 commented Feb 12, 2022

Hi many thanks for this :)

I did some digging and it turns out that the call of setOffscreenPageLimit will trigger an unwanted update of the underlying adapter and in our case updates of the fragments in this adapter. In my debug sessions actually three unwanted updates.

It turns out it would be sufficient to just call setOffscreenPageLimit before the adapter of the viewpager is set. I already pushed this fix to our main branch, I hope you don't mind. But again many thanks for your investigation, I most likely wouldn't found the cause for this issue without your help.

@SpringerJack
Copy link
Author

I'm just glad I could help and that you found a sane workaround. This PR was never intended to be a merge request anyway, so no worries about pushing the proper fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants